using System.Collections.Generic;
using System.Xml.Serialization;

namespace ColladaDotNet
{
	public partial class effect : ColladaXmlNode
	{
		public override string GetId() { return id; }
		public override IList<ColladaXmlNode> ChildNodes
		{
			get
			{
				var list = new List<ColladaXmlNode>();
				if (annotate != null)
					foreach (object e in annotate) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (image != null)
					foreach (object e in image) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (newparam != null)
					foreach (object e in newparam) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (Items != null)
					foreach (object e in Items) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (extra != null)
					foreach (object e in extra) if (e is ColladaXmlNode) list.Add((ColladaXmlNode)e);
				if (asset != null)
					list.Add(asset);
				return list;
			}
		}
		[XmlIgnore]
		public effectFx_profile_abstractProfile_COMMON CommonProfile
		{
			get
			{
				foreach (var xmlNode in Items)
				{
					if (xmlNode is effectFx_profile_abstractProfile_COMMON)
					{
						return (effectFx_profile_abstractProfile_COMMON)xmlNode;
					}
				}
				return null;
			}
		}
		[XmlIgnore]
		public effectFx_profile_abstractProfile_GLSL CommonGLSL
		{
			get
			{
				foreach (var xmlNode in Items)
				{
					if (xmlNode is effectFx_profile_abstractProfile_GLSL)
					{
						return (effectFx_profile_abstractProfile_GLSL)xmlNode;
					}
				}
				return null;
			}
		}

		public common_color_or_texture_type GetDiffuse(COLLADA doc)
		{
			if (CommonProfile.technique.Item is effectFx_profile_abstractProfile_COMMONTechniqueBlinn)
			{
				return ((effectFx_profile_abstractProfile_COMMONTechniqueBlinn)CommonProfile.technique.Item).diffuse;
			}
			if (CommonProfile.technique.Item is effectFx_profile_abstractProfile_COMMONTechniquePhong)
			{
				return ((effectFx_profile_abstractProfile_COMMONTechniquePhong)CommonProfile.technique.Item).diffuse;
			}
			if (CommonProfile.technique.Item is effectFx_profile_abstractProfile_COMMONTechniqueLambert)
			{
				return ((effectFx_profile_abstractProfile_COMMONTechniqueLambert)CommonProfile.technique.Item).diffuse;
			}
			return null;
		}
	}
}
